package com.edfu.core.util;

import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;

import org.apache.log4j.Logger;

public final class ExceptionUtils {
	
	private static final Logger logger = Logger.getLogger(ExceptionUtils.class);
	
    private ExceptionUtils() {
    }

	public static String buildErrorMessage(String errorCode, Exception cause, Object[] messageArgs) {
		logger.debug("Building error message for the error code " + errorCode);
		Locale locale = Locale.getDefault();
		
		final ResourceBundle bundle = ResourceBundle.getBundle("testMgmt", locale);
        final String message = bundle.getString(errorCode);
        return MessageFormat.format(message, messageArgs);
	}

	public static String buildLocalizedErrorMessage(String errorCode, Exception cause, Object[] messageArgs) {
		// TODO Not default locale..Identify the locale from some other approach.
		return null;
	}  
    

}
